package com.alliance.shuwei.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alliance.shuwei.entity.Category;
import com.alliance.shuwei.repository.CategoryDao;

@Service
@Transactional
public class CategoryService {
	@Autowired
	private CategoryDao categoryDao;

	public List<Category> getRootCategories() {

		return categoryDao.findRootCategory();
	}

	public void createCategory(Category category) {
		categoryDao.save(category);
	}

	public Category getCategroy(int id) {
		return categoryDao.findOne(id);
	}
}
